Skip to content

Fix[mqb]: FileStore must flush storage before control messages - #1202

Merged
dorjesinpo merged 3 commits into
mainfrom
fix/flush-storageBuilder
Mar 20, 2026
Merged

Fix[mqb]: FileStore must flush storage before control messages#1202
dorjesinpo merged 3 commits into
mainfrom
fix/flush-storageBuilder

Conversation

@dorjesinpo

Copy link
Copy Markdown
Collaborator

When sending Recovery control message, must flush the storage builder. Otherwise, data may arrive after relevant FSM event out of order.
First step is to move ControlMessageTransmitter from mqbc to mqbnet

Then, let FileStore have it and use it for transmitting control messages

Then, make the transmitter flush FileStore::d_storageEventBuilder

@dorjesinpo dorjesinpo self-assigned this Mar 18, 2026
@dorjesinpo
dorjesinpo requested a review from a team as a code owner March 18, 2026 17:23
@dorjesinpo
dorjesinpo force-pushed the fix/flush-storageBuilder branch from 88eb253 to 6aff220 Compare March 18, 2026 20:29
@dorjesinpo dorjesinpo changed the title move controlmessagetransmitter to mqbnet Fix[mqb]: FileStore must flush storage before control messages Mar 18, 2026
@dorjesinpo
dorjesinpo force-pushed the fix/flush-storageBuilder branch from 6aff220 to a9e21b4 Compare March 19, 2026 14:46
@dorjesinpo dorjesinpo assigned 678098 and unassigned dorjesinpo Mar 19, 2026
@dorjesinpo
dorjesinpo requested a review from 678098 March 19, 2026 14:49
Comment on lines +332 to +335
BALL_LOG_ERROR << description() << " teardown "
<< d_clusterData.membership().clusterNodeSessionMap().size()
<< " ClusterNodeSession";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BALL_LOG_ERROR << description() << " teardown "
<< d_clusterData.membership().clusterNodeSessionMap().size()
<< " ClusterNodeSession";

Should not be an error log

int partitionId)
void StorageUtil::transitionToActivePrimary(PartitionInfo* partitionInfo,
mqbs::FileStore* fs,
int partitionId)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int partitionId)
)

I am curious why don't we make partitionId a field in FileStore, we can use it here (extract from fs).
Current API allows to work with FileStore with provided incorrect partitionId
Also there are different members in FileStore that require partitionId arg

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you agree with this, I can do it in another PR

Comment thread src/groups/mqb/mqbc/mqbc_storageutil.h Outdated
@@ -545,9 +545,9 @@ struct StorageUtil {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment still mentions clusterData

@@ -14,7 +14,7 @@
// limitations under the License.

// mqbc_controlmessagetransmitter.cpp -*-C++-*-

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// mqbc_controlmessagetransmitter.cpp -*-C++-*-
// mqbnet_controlmessagetransmitter.cpp -*-C++-*-

// executed by the cluster *DISPATCHER* thread

// PRECONDITIONS
BSLS_ASSERT_SAFE(d_cluster_p->inDispatcherThread());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d_schemaBuilder is not thread safe, and we are lifting thread restrictions by removing this line. Do I get it right that cluster owns its ControlMessageTransmitter exclusively, and each FileStore own its copy exclusively?
Would be nice to have a same thread checker if we don't know who is the owner. Or we can provide a DispatcherClient pointer arg to constructor and verify thread against it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are downgrading this component to a lower level where the responsibility for checking is on the caller. It is becoming simpler. Like, we do not check thread safety in the builder.

#ifndef INCLUDED_MQBNET_CONTROLMESSAGETRANSMITTER
#define INCLUDED_MQBNET_CONTROLMESSAGETRANSMITTER

/// @file mqbc_controlmessagetransmitter.h

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// @file mqbc_controlmessagetransmitter.h
/// @file mqbnet_controlmessagetransmitter.h

I think there are other places with mqbc

@@ -24,7 +24,7 @@
/// @bbref{mqbc::ControlMessageTransmitter} provides a mechanism to transmit

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// @bbref{mqbc::ControlMessageTransmitter} provides a mechanism to transmit
/// @bbref{mqbnet::ControlMessageTransmitter} provides a mechanism to transmit

678098
678098 previously approved these changes Mar 19, 2026
d_clusterData.messageTransmitter().broadcastMessage(
controlMsg,
d_clusterData.transportManager());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Trailing spaces

Signed-off-by: dorjesinpo <129227380+dorjesinpo@users.noreply.github.com>
Signed-off-by: dorjesinpo <129227380+dorjesinpo@users.noreply.github.com>
Signed-off-by: dorjesinpo <129227380+dorjesinpo@users.noreply.github.com>
@dorjesinpo
dorjesinpo force-pushed the fix/flush-storageBuilder branch from d68718c to 8babee8 Compare March 20, 2026 01:30
@dorjesinpo dorjesinpo assigned 678098 and unassigned dorjesinpo Mar 20, 2026
@dorjesinpo

Copy link
Copy Markdown
Collaborator Author

IT failures are unrelated and being fixed

@dorjesinpo
dorjesinpo merged commit 85076ea into main Mar 20, 2026
40 of 44 checks passed
@678098
678098 deleted the fix/flush-storageBuilder branch March 20, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants